package com.lyx.bank.config;

import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zhiyuan
 */
@Configuration
public class TtlQueueConfig {

    @Bean
    public FanoutExchange bankExchange(){
        return new FanoutExchange("bank.fanout");
    }

    @Bean
    public Queue bankQueue1(){
        return new Queue("bank.queue1");
    }

    /**
     * 绑定队列和交换机
     */
    @Bean
    public Binding bindingQueue1(Queue bankQueue1, FanoutExchange bankExchange){
        return BindingBuilder.bind(bankQueue1).to(bankExchange);
    }
}
